package com.situ.struts.interceprot;


import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class MyInterceptor1 implements Interceptor {

    public MyInterceptor1() {
        System.out.println("MyInterceptor1 MyInterceptor1()");
    }

    @Override
    public void init() {
        System.out.println("MyInterceptor1 init()");
    }

    @Override
    public String intercept(ActionInvocation invocation) throws Exception {
        System.out.println("MyInterceptor1 intercept() 开始");
        // 有下一个拦截器就执行下一个拦截器，没有就访问Action中方法
        String result = invocation.invoke();
        System.out.println("MyInterceptor1 intercept() 结束");
        return result;
    }

    @Override
    public void destroy() {
        System.out.println("MyInterceptor1 destroy()");

    }
}
